USE [GESTION_MORA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_D0007_CAMPO_SECURITIZADO]    Script Date: 11/23/2011 15:18:29 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WASP_D0007_CAMPO_SECURITIZADO]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[WASP_D0007_CAMPO_SECURITIZADO]
GO

USE [GESTION_MORA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_D0007_CAMPO_SECURITIZADO]    Script Date: 11/23/2011 15:18:29 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[WASP_D0007_CAMPO_SECURITIZADO]
AS

update gmsmorasuc set Mca_securitizado = 'S'
FROM [GESTION2].[dbo].[FSEC10_DIA]  
where  [Sec10StsPt]  = 9 and
            sec10aocta = cuenta and
            sec10aoope = operacion

update  gmsmorasuc
set Estado = CASE 
                    when Vcto_Impago = '1900-01-01' then 'ERROR CONSISTENCIA EN BANTOTAL'
                    else 'NORMAL'
                    end
GO

